/*
 *  Copyright 2001-2004 The Apache Software Foundation
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package ar.uba.fi.posgrado.common.service;

import java.util.List;

import ar.uba.fi.posgrado.common.dao.NoSuchEntityException;
import ar.uba.fi.posgrado.common.exception.MissingArgumentException;
import ar.uba.fi.posgrado.common.exception.PosgradoException;
import ar.uba.fi.posgrado.common.exception.PosgradoRuntimeException;
import ar.uba.fi.posgrado.common.exception.RepeatedInstanceException;
import ar.uba.fi.posgrado.common.exception.RepeatedNameException;
import ar.uba.fi.posgrado.common.model.Student;
import ar.uba.fi.posgrado.economy.model.Customer;

public interface StudentService extends GenericService<Student> {

	/**
	 * Devuelve un alumno a partir de su documento (o personalId)
	 * 
	 * @param studentPersonalId
	 * @return alumno con ese documento
	 */
	public abstract Student getByPersonalId(String studentPersonalId)
			throws PosgradoRuntimeException, PosgradoException;

	/**
	 * Crea un alumno nuevo
	 * 
	 * @param student
	 *            alumno a crear
	 * @throws PosgradoRuntimeException
	 * @throws RepeatedInstanceException
	 * @throws PosgradoException
	 */
	public abstract void create(Student student)
			throws PosgradoRuntimeException, PosgradoException,
			RepeatedInstanceException, MissingArgumentException;

	/**
	 * Modifica los datos del alumno que se pasa por parametro, si existe. En
	 * caso contrario, lanza una excepcion
	 * 
	 * @param student
	 *            alumno a actualizar
	 * @throws PosgradoRuntimeException
	 * @throws RepeatedInstanceException
	 * @throws PosgradoException
	 */
	public abstract Student update(Student student)
			throws PosgradoRuntimeException, PosgradoException,
			NoSuchEntityException, RepeatedNameException;

	/**
	 * Busca por apellido.<br>
	 * Hace una busqueda NO exacta, o sea, con q matchee parte del String es
	 * suficiente.<br>
	 * 
	 * @param surname
	 *            apellido
	 * @return
	 * @throws PosgradoRuntimeException
	 * @throws PosgradoException
	 */
	public abstract List<Student> getBySurname(String surname)
			throws PosgradoRuntimeException, PosgradoException;

	/**
	 * Crea un Alumno y también crea un Cliente, con los datos del Alumno<br>
	 * 
	 * @param student
	 *            alumno
	 * @param customer
	 *            cliente
	 * @throws PosgradoException
	 * @throws PosgradoRuntimeException
	 */
	public abstract void createStudentAndCustomer(Student student,
			Customer customer) throws PosgradoException,
			PosgradoRuntimeException;

}
